<script  lang="ts">
import { ref, reactive } from 'vue'
import {  watchEffect } from 'vue'; 
let a = ref([1, 3, 5, 7, 9, 2, 4, 6, 8])
//添加
let aaa = a.value.map((element, value) => {
  if (value === 3) {
    return 'vue3'
  }
  return element
})
console.log(aaa, 'v')
//反转
let arr = [5, 3, 2, 1, 6, 8, 4, 3]
function arrs(arr: any) {
  let Index
  for (let index = 0; index < arr.length; index++) {
    Index = index
    for (let i = 0; i < arr.length; i++) {
      Index = i
    }
    if (Index !== index) {
      ;[arr[index], arr[Index]] = [arr[Index], arr[index]]
      //多【】
    }
  }
  return arr
}
console.log(arrs(arr), '1111')
//去重
let arr1 = [5, 3, 2, 1, 6, 8, 4, 3,1,7,8,9]
console.log(arr1,"yyy767")
 let fil=arr1.filter((item:any,index:any)=>{
   return arr1.indexOf(item)===index
 })
 console.log(fil,"767")
 //删除
 let arr11 = [5, 3, 2, 1, 6, 8, 4, 3]
 for (let index = 3; index < arr11.length-1; index++) {
 arr11[index]=arr11[index+1]
    
 }
 arr11.length--
 console.log(arr11,"5555555555")


 //删除数组  为空
 let  cccb= [5, 3, 2, 1, 6, 8, 4, 3]
 
cccb.length=0
 console.log(cccb,"【】")

 let cccb14 = [1, 2, 3];  
let bbsb14 = ['数组', 99, '拼接']; 
let PINJIE=[...cccb14,...bbsb14] 
console.log(PINJIE,"【PINJIE】")

 
  
export default {  
  setup() {  
    const count = ref(0);  
  
    // watchEffect(() => {  
    //   console.log('数据变化了:', count.value);  
    //   // 在这里执行你的刷新逻辑  
    // });  
  
    // // 模拟数据变化  
    // setInterval(() => {  
    //   count.value++;  
    // }, 1000);  
  
    return { count };  
  },  
};
</script>

<template>
  <div class="sf"></div>
</template>

<style lang="scss" scoped></style>
